package com.changcheng.project.yuminsi.enums;

/**
 * @author yuminsi
 * @description
 * @date 2020/8/22 21:49
 * @since
 */
public enum UserType {
    /**
     * 不记名
     */
    USER_TYPE_0("不记名", "0"),
    /**
     * 个人用户
     */
    USER_TYPE_1("个人用户", "1"),
    /**
     * 单位用户
     */
    USER_TYPE_2("单位用户", "2");


    private String name;
    private String code;

    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }

    UserType() {
    }

    UserType(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public static UserType getEnumType(String code) {
        UserType[] userTypes = UserType.values();
        for (UserType userType : userTypes) {
            if (userType.getCode().equals(code)) {
                return userType;
            }
        }
        return null;
    }
}
